#include "widget.h"
#include "ui_widget.h"

#include <QIcon>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

//    QIcon icon("D:/rose.jpg");
    QIcon icon(":/icon/rose.jpg");
    this->setWindowIcon(icon);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_ADD_clicked()
{
    float opacity = this->windowOpacity();
    if (opacity<1)
    {
       opacity+=0.1;
    }
    this->setWindowOpacity(opacity);
}

void Widget::on_pushButton_SUB_clicked()
{
    float opacity = this->windowOpacity();
    if (opacity>0.2)
    {
       opacity-=0.1;
    }
    this->setWindowOpacity(opacity);
}

void Widget::on_pushButtonCursor_clicked()
{
    QCursor lo_cursor(Qt::WaitCursor);
    ui->pushButtonCursor->setCursor(lo_cursor);
}

void Widget::on_pushButtonCloud_clicked()
{
    //访问到图片 pixmap 图像
    QPixmap pixmap(":/icon/cloud.jpg");
    //缩放
    pixmap =pixmap.scaled(100,100);
    //创建光标
    QCursor cursor(pixmap,10,10);
    //设置光标
    this->setCursor(cursor);
}
